package com.demo.security.cloud.servicecenter.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

	@GetMapping(value = "/hello", produces = "text/plain;charset=utf-8")
	public String hello() {
		return "hello spring boot";
	}

	@GetMapping(value = "/r/r1")
	@PreAuthorize("hasAnyAuthority('p1')")
	public String r1(){
		return "resource: r1";
	}

	@GetMapping(value = "/r/r2")
	@PreAuthorize("hasAnyAuthority('p2')")
	public String r2(){
		return "resource: r2";
	}
}
 
